package com.qijian.maindata.domain.query;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.util.Date;
import java.util.List;
import java.util.Set;


/**
 * 下料转运单对象 查询条件类
 *
 * @author qijian
 * @date 2024-05-31
 */

@Data
@ToString
@TableName("main_nc_order_transport_sawing")
public class NcOrderTransportSawingQuery {

    @WhereType(filed = "id")
    private Long id;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private Set<Long> ids;
    @WhereType(filed = "code", type = WhereTypeEnum.LIKE)
    private String code;
    @WhereType(filed = "user_id")
    private Long userId;
    @WhereType(filed = "nick_name", type = WhereTypeEnum.LIKE)
    private String nickName;
    @WhereType(filed = "dept_id")
    private Long deptId;
    @WhereType(filed = "dept_name", type = WhereTypeEnum.LIKE)
    private String deptName;
    @WhereType(filed = "receive_id")
    private Long receiveId;
    @WhereType(filed = "receive_name", type = WhereTypeEnum.LIKE)
    private String receiveName;
    @WhereType(filed = "receive_dept_id")
    private Long receiveDeptId;
    @WhereType(filed = "receive_dept_name", type = WhereTypeEnum.LIKE)
    private String receiveDeptName;
    @WhereType(filed = "transport_date", type = WhereTypeEnum.BETWEEN)
    private Date[] transportDate;
    @WhereType(filed = "sign_date", type = WhereTypeEnum.BETWEEN)
    private Date[] signDate;
    @WhereType(filed = "status")
    private String status;
    @WhereType(filed = "diff")
    private Boolean diff;
    @WhereType(filed = "create_by_id")
    private Long createById;

    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private List<Long> idList;

    @WhereType(func = "(receive_id ={1} OR create_by_id = {1} )")
    private Long owner;

    @WhereType(func = "main_nc_order_transport_sawing.id in (select main_id from main_nc_order_transport_sawing_detail " +
            "left join main_project on main_nc_order_transport_sawing_detail.project_id = main_project.project_id and main_project.is_del = 0 " +
            "where main_nc_order_transport_sawing_detail.is_del = 0 and main_project.project_machine_no like concat('%', {1}, '%') )")
    private String projectMachineNo;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date transportDateInfo;

    @WhereType(filed = "transport_type")
    private String transportType;

    @WhereType(func = "main_nc_order_transport_sawing.id in (select main_id from main_nc_order_transport_sawing_detail " +
            "where is_del = 0 and drawing_no like concat('%', {1}, '%') )")
    private String drawingNo;
    @WhereType(func = "main_nc_order_transport_sawing.id in (select main_id from main_nc_order_transport_sawing_detail " +
            "where is_del = 0 and part_no like concat('%', {1}, '%') )")
    private String partNo;
}
